*Dataset is from the CCD-project, see further http://www.mzes.uni-mannheim.dk/d7/en/datasets/comparative-campaign-dynamics-dataset

******************************************************************
*Parties' LF-placement - values to be found at parlgov.org webpage for each country 
******************************************************************
gen hv = .
replace hv=7.3 if country=="DK" & subject==1
replace hv=3.8 if country=="DK" & subject==2
replace hv=8.2 if country=="DK" & subject==3
replace hv=2.1 if country=="DK" & subject==4
replace hv=7.2 if country=="DK" & subject==5
replace hv=4.9 if country=="DK" & subject==6
replace hv=0.9 if country=="DK" & subject==7
replace hv=6.0 if country=="DK" & subject==8
replace hv=6.0 if country=="DK" & subject==9
replace hv=. if country=="DK" & subject==10

replace hv=3.0 if country=="CZ" & subject==1
replace hv=7.4 if country=="CZ" & subject==2
replace hv=0.7 if country=="CZ" & subject==3
replace hv=5.8 if country=="CZ" & subject==4
replace hv=7.4 if country=="CZ" & subject==5
replace hv=6.0 if country=="CZ" & subject==6
replace hv=6.0 if country=="CZ" & subject==7
replace hv=7.4 if country=="CZ" & subject==8
replace hv=. if country=="CZ" & subject==9

replace hv=6.3 if country=="DE" & subject==1
replace hv=7.3 if country=="DE" & subject==2
replace hv=6.3 if country=="DE" & subject==3
replace hv=3.6 if country=="DE" & subject==4
replace hv=5.9 if country=="DE" & subject==5
replace hv=2.9 if country=="DE" & subject==6
replace hv=1.2 if country=="DE" & subject==7
replace hv=8.8 if country=="DE" & subject==8
replace hv=. if country=="DE" & subject==9
replace hv=. if country=="DE" & subject==10

replace hv=. if country=="HU" & subject==1
replace hv=7.4 if country=="HU" & subject==2
replace hv=6.5 if country=="HU" & subject==3
replace hv=2.9 if country=="HU" & subject==4
replace hv=9.6 if country=="HU" & subject==5 & year_month==2006
replace hv=8.8 if country=="HU" & subject==5 & year_month==2010
replace hv=4.0 if country=="HU" & subject==6
replace hv=6.5 if country=="HU" & subject==7
replace hv=2.5 if country=="HU" & subject==8
replace hv=. if country=="HU" & subject==9

replace hv=3.6 if country=="NL" & subject==1
replace hv=5.9 if country=="NL" & subject==2
replace hv=7.3 if country=="NL" & subject==3
replace hv=4.5 if country=="NL" & subject==4
replace hv=1.4 if country=="NL" & subject==5
replace hv=8.8 if country=="NL" & subject==6
replace hv=6.2 if country=="NL" & subject==7
replace hv=2.0 if country=="NL" & subject==8
replace hv=. if country=="NL" & subject==9
replace hv=6.0 if country=="NL" & subject==10
replace hv=. if country=="NL" & subject==11

replace hv=7.7 if country=="PL" & subject==1
replace hv=6.2 if country=="PL" & subject==2
replace hv=2.6 if country=="PL" & subject==3
replace hv=4.2 if country=="PL" & subject==4
replace hv=8.9 if country=="PL" & subject==5
replace hv=4.0 if country=="PL" & subject==6
replace hv=6.0 if country=="PL" & subject==7
replace hv=7.4 if country=="PL" & subject==8
replace hv=. if country=="PL" & subject==9

replace hv=4.0 if country=="PO" & subject==1
replace hv=6.3 if country=="PO" & subject==2
replace hv=2.2 if country=="PO" & subject==3
replace hv=1.6 if country=="PO" & subject==4
replace hv=8.0 if country=="PO" & subject==5

replace hv=1.5 if country=="SV" & subject==1
replace hv=3.4 if country=="SV" & subject==2
replace hv=3.4 if country=="SV" & subject==3
replace hv=5.8 if country=="SV" & subject==4
replace hv=6.3 if country=="SV" & subject==5
replace hv=7.9 if country=="SV" & subject==6
replace hv=7.2 if country=="SV" & subject==7
replace hv=8.8 if country=="SV" & subject==8
replace hv=. if country=="SV" & subject==9
replace hv=. if country=="SV" & subject==10
replace hv=. if country=="SV" & subject==11

replace hv=4.4 if country=="UK" & subject==1
replace hv=4.3 if country=="UK" & subject==2
replace hv=7.4 if country=="UK" & subject==3
replace hv=7.8 if country=="UK" & subject==4
replace hv=3.6 if country=="UK" & subject==5
replace hv=. if country=="UK" & subject==6

replace hv=3.7 if country=="ES" & subject==1
replace hv=7.6 if country=="ES" & subject==2
replace hv=2.0 if country=="ES" & subject==3
replace hv=6.3 if country=="ES" & subject==4
replace hv=3.1 if country=="ES" & subject==5
replace hv=6.2 if country=="ES" & subject==6
replace hv=6.0 if country=="ES" & subject==6

*****************************************************************
*Proximity to center - parties' closeness to the center on the LR-scale
*****************************************************************

gen hv_prox =.
replace hv_prox = 0 if hv==5 
replace hv_prox = 5 - hv if hv<5 
replace hv_prox = hv - 5 if hv>5
ta hv_prox
sum hv

******************************************************************
*Government or not - values to be found at parlgov.org webpage for each country
******************************************************************
gen gov = .

replace gov=1 if country=="DK" & year_month==2007 & subject==1
replace gov=0 if country=="DK" & year_month==2007 & subject==2
replace gov=0 if country=="DK" & year_month==2007 & subject==3
replace gov=0 if country=="DK" & year_month==2007 & subject==4
replace gov=1 if country=="DK" & year_month==2007 & subject==5
replace gov=0 if country=="DK" & year_month==2007 & subject==6
replace gov=0 if country=="DK" & year_month==2007 & subject==7
replace gov=0 if country=="DK" & year_month==2007 & subject==8
replace gov=0 if country=="DK" & year_month==2007 & subject==9
replace gov=1 if country=="DK" & year_month==2007 & subject==10

replace gov=1 if country=="DK" & year_month==2011 & subject==1
replace gov=0 if country=="DK" & year_month==2011 & subject==2
replace gov=0 if country=="DK" & year_month==2011 & subject==3
replace gov=0 if country=="DK" & year_month==2011 & subject==4
replace gov=1 if country=="DK" & year_month==2011 & subject==5
replace gov=0 if country=="DK" & year_month==2011 & subject==6
replace gov=0 if country=="DK" & year_month==2011 & subject==7
replace gov=0 if country=="DK" & year_month==2011 & subject==8
replace gov=0 if country=="DK" & year_month==2011 & subject==9
replace gov=1 if country=="DK" & year_month==2011 & subject==10

replace gov=1 if country=="CZ" & year_month==2010 & subject==1
replace gov=1 if country=="CZ" & year_month==2010 & subject==2
replace gov=0 if country=="CZ" & year_month==2010 & subject==3
replace gov=0 if country=="CZ" & year_month==2010 & subject==4
replace gov=0 if country=="CZ" & year_month==2010 & subject==5
replace gov=0 if country=="CZ" & year_month==2010 & subject==6
replace gov=0 if country=="CZ" & year_month==2010 & subject==7
replace gov=0 if country=="CZ" & year_month==2010 & subject==8
replace gov=1 if country=="CZ" & year_month==2010 & subject==9

replace gov=0 if country=="CZ" & year_month==2013 & subject==1
replace gov=1 if country=="CZ" & year_month==2013 & subject==2
replace gov=0 if country=="CZ" & year_month==2013 & subject==3
replace gov=0 if country=="CZ" & year_month==2013 & subject==4
replace gov=1 if country=="CZ" & year_month==2013 & subject==5
replace gov=1 if country=="CZ" & year_month==2013 & subject==6
replace gov=0 if country=="CZ" & year_month==2013 & subject==7
replace gov=0 if country=="CZ" & year_month==2013 & subject==8
replace gov=1 if country=="CZ" & year_month==2013 & subject==9

replace gov=1 if country=="DE" & year_month==2009 & subject==1
replace gov=1 if country=="DE" & year_month==2009 & subject==2
replace gov=1 if country=="DE" & year_month==2009 & subject==3
replace gov=1 if country=="DE" & year_month==2009 & subject==4
replace gov=0 if country=="DE" & year_month==2009 & subject==5
replace gov=0 if country=="DE" & year_month==2009 & subject==6
replace gov=0 if country=="DE" & year_month==2009 & subject==7
replace gov=0 if country=="DE" & year_month==2009 & subject==8
replace gov=0 if country=="DE" & year_month==2009 & subject==9
replace gov=1 if country=="DE" & year_month==2009 & subject==10

replace gov=1 if country=="DE" & year_month==2013 & subject==1
replace gov=1 if country=="DE" & year_month==2013 & subject==2
replace gov=1 if country=="DE" & year_month==2013 & subject==3
replace gov=0 if country=="DE" & year_month==2013 & subject==4
replace gov=1 if country=="DE" & year_month==2013 & subject==5
replace gov=0 if country=="DE" & year_month==2013 & subject==6
replace gov=0 if country=="DE" & year_month==2013 & subject==7
replace gov=0 if country=="DE" & year_month==2013 & subject==8
replace gov=0 if country=="DE" & year_month==2013 & subject==9
replace gov=1 if country=="DE" & year_month==2013 & subject==10

replace gov=0 if country=="HU" & year_month==2006 & subject==1
replace gov=0 if country=="HU" & year_month==2006 & subject==2
replace gov=0 if country=="HU" & year_month==2006 & subject==3
replace gov=1 if country=="HU" & year_month==2006 & subject==4
replace gov=0 if country=="HU" & year_month==2006 & subject==5
replace gov=1 if country=="HU" & year_month==2006 & subject==6
replace gov=0 if country=="HU" & year_month==2006 & subject==7
replace gov=0 if country=="HU" & year_month==2006 & subject==8
replace gov=1 if country=="HU" & year_month==2006 & subject==9

replace gov=0 if country=="HU" & year_month==2010 & subject==1
replace gov=0 if country=="HU" & year_month==2010 & subject==2
replace gov=0 if country=="HU" & year_month==2010 & subject==3
replace gov=1 if country=="HU" & year_month==2010 & subject==4
replace gov=0 if country=="HU" & year_month==2010 & subject==5
replace gov=0 if country=="HU" & year_month==2010 & subject==6
replace gov=0 if country=="HU" & year_month==2010 & subject==7
replace gov=0 if country=="HU" & year_month==2010 & subject==8
replace gov=1 if country=="HU" & year_month==2010 & subject==9

replace gov=1 if country=="NL" & year_month==2010 & subject==1
replace gov=1 if country=="NL" & year_month==2010 & subject==2
replace gov=0 if country=="NL" & year_month==2010 & subject==3
replace gov=0 if country=="NL" & year_month==2010 & subject==4
replace gov=0 if country=="NL" & year_month==2010 & subject==5
replace gov=0 if country=="NL" & year_month==2010 & subject==6
replace gov=1 if country=="NL" & year_month==2010 & subject==7
replace gov=0 if country=="NL" & year_month==2010 & subject==8
replace gov=0 if country=="NL" & year_month==2010 & subject==9
replace gov=0 if country=="NL" & year_month==2010 & subject==10
replace gov=1 if country=="NL" & year_month==2010 & subject==11

replace gov=0 if country=="NL" & year_month==2012 & subject==1
replace gov=1 if country=="NL" & year_month==2012 & subject==2
replace gov=1 if country=="NL" & year_month==2012 & subject==3
replace gov=0 if country=="NL" & year_month==2012 & subject==4
replace gov=0 if country=="NL" & year_month==2012 & subject==5
replace gov=0 if country=="NL" & year_month==2012 & subject==6
replace gov=0 if country=="NL" & year_month==2012 & subject==7
replace gov=0 if country=="NL" & year_month==2012 & subject==8
replace gov=0 if country=="NL" & year_month==2012 & subject==9
replace gov=0 if country=="NL" & year_month==2012 & subject==10
replace gov=1 if country=="NL" & year_month==2012 & subject==11

replace gov=1 if country=="PL" & year_month==2007 & subject==1
replace gov=0 if country=="PL" & year_month==2007 & subject==2
replace gov=0 if country=="PL" & year_month==2007 & subject==3
replace gov=0 if country=="PL" & year_month==2007 & subject==4
replace gov=1 if country=="PL" & year_month==2007 & subject==5
replace gov=1 if country=="PL" & year_month==2007 & subject==6
replace gov=0 if country=="PL" & year_month==2007 & subject==7
replace gov=0 if country=="PL" & year_month==2007 & subject==8
replace gov=1 if country=="PL" & year_month==2007 & subject==9

replace gov=0 if country=="PL" & year_month==2011 & subject==1
replace gov=1 if country=="PL" & year_month==2011 & subject==2
replace gov=0 if country=="PL" & year_month==2011 & subject==3
replace gov=1 if country=="PL" & year_month==2011 & subject==4
replace gov=0 if country=="PL" & year_month==2011 & subject==5
replace gov=0 if country=="PL" & year_month==2011 & subject==6
replace gov=0 if country=="PL" & year_month==2011 & subject==7
replace gov=0 if country=="PL" & year_month==2011 & subject==8
replace gov=1 if country=="PL" & year_month==2011 & subject==9

replace gov=1 if country=="PO" & year_month==2009 & subject==1
replace gov=0 if country=="PO" & year_month==2009 & subject==2
replace gov=0 if country=="PO" & year_month==2009 & subject==3
replace gov=0 if country=="PO" & year_month==2009 & subject==4
replace gov=0 if country=="PO" & year_month==2009 & subject==5

replace gov=1 if country=="PO" & year_month==2011 & subject==1
replace gov=0 if country=="PO" & year_month==2011 & subject==2
replace gov=0 if country=="PO" & year_month==2011 & subject==3
replace gov=0 if country=="PO" & year_month==2011 & subject==4
replace gov=0 if country=="PO" & year_month==2011 & subject==5

replace gov=0 if country=="SV" & year_month==2010 & subject==1
replace gov=0 if country=="SV" & year_month==2010 & subject==2
replace gov=0 if country=="SV" & year_month==2010 & subject==3
replace gov=1 if country=="SV" & year_month==2010 & subject==4
replace gov=1 if country=="SV" & year_month==2010 & subject==5
replace gov=1 if country=="SV" & year_month==2010 & subject==6
replace gov=1 if country=="SV" & year_month==2010 & subject==7
replace gov=0 if country=="SV" & year_month==2010 & subject==8
replace gov=0 if country=="SV" & year_month==2010 & subject==9
replace gov=0 if country=="SV" & year_month==2010 & subject==10
replace gov=1 if country=="SV" & year_month==2010 & subject==11

replace gov=0 if country=="SV" & year_month==2014 & subject==1
replace gov=0 if country=="SV" & year_month==2014 & subject==2
replace gov=0 if country=="SV" & year_month==2014 & subject==3
replace gov=1 if country=="SV" & year_month==2014 & subject==4
replace gov=1 if country=="SV" & year_month==2014 & subject==5
replace gov=1 if country=="SV" & year_month==2014 & subject==6
replace gov=1 if country=="SV" & year_month==2014 & subject==7
replace gov=0 if country=="SV" & year_month==2014 & subject==8
replace gov=0 if country=="SV" & year_month==2014 & subject==9
replace gov=0 if country=="SV" & year_month==2014 & subject==10
replace gov=1 if country=="SV" & year_month==2014 & subject==11

replace gov=1 if country=="UK" & year_month==2005 & subject==1
replace gov=0 if country=="UK" & year_month==2005 & subject==2
replace gov=0 if country=="UK" & year_month==2005 & subject==3

replace gov=1 if country=="UK" & year_month==2010 & subject==1
replace gov=0 if country=="UK" & year_month==2010 & subject==2
replace gov=0 if country=="UK" & year_month==2010 & subject==3

replace gov=0 if country=="UK" & year_month==2015 & subject==1
replace gov=1 if country=="UK" & year_month==2015 & subject==2
replace gov=1 if country=="UK" & year_month==2015 & subject==3
replace gov=0 if country=="UK" & year_month==2015 & subject==4
replace gov=0 if country=="UK" & year_month==2015 & subject==5
replace gov=1 if country=="UK" & year_month==2015 & subject==6

replace gov=0 if country=="ES" & year_month==2004 & subject==1
replace gov=1 if country=="ES" & year_month==2004 & subject==2
replace gov=0 if country=="ES" & year_month==2004 & subject==3
replace gov=0 if country=="ES" & year_month==2004 & subject==4
replace gov=0 if country=="ES" & year_month==2004 & subject==5
replace gov=0 if country=="ES" & year_month==2004 & subject==6
replace gov=0 if country=="ES" & year_month==2004 & subject==7

replace gov=1 if country=="ES" & year_month==2008 & subject==1
replace gov=0 if country=="ES" & year_month==2008 & subject==2
replace gov=0 if country=="ES" & year_month==2008 & subject==3
replace gov=0 if country=="ES" & year_month==2008 & subject==4
replace gov=0 if country=="ES" & year_month==2008 & subject==5
replace gov=0 if country=="ES" & year_month==2008 & subject==6
replace gov=0 if country=="ES" & year_month==2008 & subject==7

replace gov=1 if country=="ES" & year_month==2011 & subject==1
replace gov=0 if country=="ES" & year_month==2011 & subject==2
replace gov=0 if country=="ES" & year_month==2011 & subject==3
replace gov=0 if country=="ES" & year_month==2011 & subject==4
replace gov=0 if country=="ES" & year_month==2011 & subject==5
replace gov=0 if country=="ES" & year_month==2011 & subject==6
replace gov=0 if country=="ES" & year_month==2011 & subject==7

ta gov

******************************************************************
*Prime minister or not  - values to be found at parlgov.org webpage for each country
******************************************************************

gen gov_pm = .

replace gov_pm=1 if country=="DK" & year_month==2007 & subject==1
replace gov_pm=0 if country=="DK" & year_month==2007 & subject==2
replace gov_pm=0 if country=="DK" & year_month==2007 & subject==3
replace gov_pm=0 if country=="DK" & year_month==2007 & subject==4
replace gov_pm=0 if country=="DK" & year_month==2007 & subject==5
replace gov_pm=0 if country=="DK" & year_month==2007 & subject==6
replace gov_pm=0 if country=="DK" & year_month==2007 & subject==7
replace gov_pm=0 if country=="DK" & year_month==2007 & subject==8
replace gov_pm=0 if country=="DK" & year_month==2007 & subject==9
replace gov_pm=0 if country=="DK" & year_month==2007 & subject==10

replace gov_pm=1 if country=="DK" & year_month==2011 & subject==1
replace gov_pm=0 if country=="DK" & year_month==2011 & subject==2
replace gov_pm=0 if country=="DK" & year_month==2011 & subject==3
replace gov_pm=0 if country=="DK" & year_month==2011 & subject==4
replace gov_pm=0 if country=="DK" & year_month==2011 & subject==5
replace gov_pm=0 if country=="DK" & year_month==2011 & subject==6
replace gov_pm=0 if country=="DK" & year_month==2011 & subject==7
replace gov_pm=0 if country=="DK" & year_month==2011 & subject==8
replace gov_pm=0 if country=="DK" & year_month==2011 & subject==9
replace gov_pm=0 if country=="DK" & year_month==2011 & subject==10

replace gov_pm=0 if country=="CZ" & year_month==2013 & subject==1
replace gov_pm=0 if country=="CZ" & year_month==2013 & subject==2
replace gov_pm=0 if country=="CZ" & year_month==2013 & subject==3
replace gov_pm=0 if country=="CZ" & year_month==2013 & subject==4
replace gov_pm=0 if country=="CZ" & year_month==2013 & subject==5
replace gov_pm=0 if country=="CZ" & year_month==2013 & subject==6
replace gov_pm=0 if country=="CZ" & year_month==2013 & subject==7
replace gov_pm=0 if country=="CZ" & year_month==2013 & subject==8
replace gov_pm=0 if country=="CZ" & year_month==2013 & subject==9

replace gov_pm=0 if country=="CZ" & year_month==2010 & subject==1
replace gov_pm=1 if country=="CZ" & year_month==2010 & subject==2
replace gov_pm=0 if country=="CZ" & year_month==2010 & subject==3
replace gov_pm=0 if country=="CZ" & year_month==2010 & subject==4
replace gov_pm=0 if country=="CZ" & year_month==2010 & subject==5
replace gov_pm=0 if country=="CZ" & year_month==2010 & subject==6
replace gov_pm=0 if country=="CZ" & year_month==2010 & subject==7
replace gov_pm=0 if country=="CZ" & year_month==2010 & subject==8
replace gov_pm=0 if country=="CZ" & year_month==2010 & subject==9

replace gov_pm=1 if country=="DE" & year_month==2009 & subject==1
replace gov_pm=0 if country=="DE" & year_month==2009 & subject==2
replace gov_pm=0 if country=="DE" & year_month==2009 & subject==3
replace gov_pm=0 if country=="DE" & year_month==2009 & subject==4
replace gov_pm=0 if country=="DE" & year_month==2009 & subject==5
replace gov_pm=0 if country=="DE" & year_month==2009 & subject==6
replace gov_pm=0 if country=="DE" & year_month==2009 & subject==7
replace gov_pm=0 if country=="DE" & year_month==2009 & subject==8
replace gov_pm=0 if country=="DE" & year_month==2009 & subject==9
replace gov_pm=0 if country=="DE" & year_month==2009 & subject==10

replace gov_pm=1 if country=="DE" & year_month==2013 & subject==1
replace gov_pm=0 if country=="DE" & year_month==2013 & subject==2
replace gov_pm=0 if country=="DE" & year_month==2013 & subject==3
replace gov_pm=0 if country=="DE" & year_month==2013 & subject==4
replace gov_pm=0 if country=="DE" & year_month==2013 & subject==5
replace gov_pm=0 if country=="DE" & year_month==2013 & subject==6
replace gov_pm=0 if country=="DE" & year_month==2013 & subject==7
replace gov_pm=0 if country=="DE" & year_month==2013 & subject==8
replace gov_pm=0 if country=="DE" & year_month==2013 & subject==9
replace gov_pm=0 if country=="DE" & year_month==2013 & subject==10

replace gov_pm=0 if country=="HU" & year_month==2006 & subject==1
replace gov_pm=0 if country=="HU" & year_month==2006 & subject==2
replace gov_pm=0 if country=="HU" & year_month==2006 & subject==3
replace gov_pm=1 if country=="HU" & year_month==2006 & subject==4
replace gov_pm=0 if country=="HU" & year_month==2006 & subject==5
replace gov_pm=0 if country=="HU" & year_month==2006 & subject==6
replace gov_pm=0 if country=="HU" & year_month==2006 & subject==7
replace gov_pm=0 if country=="HU" & year_month==2006 & subject==8
replace gov_pm=0 if country=="HU" & year_month==2006 & subject==9

replace gov_pm=0 if country=="HU" & year_month==2010 & subject==1
replace gov_pm=0 if country=="HU" & year_month==2010 & subject==2
replace gov_pm=0 if country=="HU" & year_month==2010 & subject==3
replace gov_pm=1 if country=="HU" & year_month==2010 & subject==4
replace gov_pm=0 if country=="HU" & year_month==2010 & subject==5
replace gov_pm=0 if country=="HU" & year_month==2010 & subject==6
replace gov_pm=0 if country=="HU" & year_month==2010 & subject==7
replace gov_pm=0 if country=="HU" & year_month==2010 & subject==8
replace gov_pm=0 if country=="HU" & year_month==2010 & subject==9

replace gov_pm=0 if country=="NL" & year_month==2010 & subject==1
replace gov_pm=1 if country=="NL" & year_month==2010 & subject==2
replace gov_pm=0 if country=="NL" & year_month==2010 & subject==3
replace gov_pm=0 if country=="NL" & year_month==2010 & subject==4
replace gov_pm=0 if country=="NL" & year_month==2010 & subject==5
replace gov_pm=0 if country=="NL" & year_month==2010 & subject==6
replace gov_pm=0 if country=="NL" & year_month==2010 & subject==7
replace gov_pm=0 if country=="NL" & year_month==2010 & subject==8
replace gov_pm=0 if country=="NL" & year_month==2010 & subject==9
replace gov_pm=0 if country=="NL" & year_month==2010 & subject==10
replace gov_pm=0 if country=="NL" & year_month==2010 & subject==11

replace gov_pm=0 if country=="NL" & year_month==2012 & subject==1
replace gov_pm=0 if country=="NL" & year_month==2012 & subject==2
replace gov_pm=1 if country=="NL" & year_month==2012 & subject==3
replace gov_pm=0 if country=="NL" & year_month==2012 & subject==4
replace gov_pm=0 if country=="NL" & year_month==2012 & subject==5
replace gov_pm=0 if country=="NL" & year_month==2012 & subject==6
replace gov_pm=0 if country=="NL" & year_month==2012 & subject==7
replace gov_pm=0 if country=="NL" & year_month==2012 & subject==8
replace gov_pm=0 if country=="NL" & year_month==2012 & subject==9
replace gov_pm=0 if country=="NL" & year_month==2012 & subject==10
replace gov_pm=0 if country=="NL" & year_month==2012 & subject==11

replace gov_pm=1 if country=="PL" & year_month==2007 & subject==1
replace gov_pm=0 if country=="PL" & year_month==2007 & subject==2
replace gov_pm=0 if country=="PL" & year_month==2007 & subject==3
replace gov_pm=0 if country=="PL" & year_month==2007 & subject==4
replace gov_pm=0 if country=="PL" & year_month==2007 & subject==5
replace gov_pm=0 if country=="PL" & year_month==2007 & subject==6
replace gov_pm=0 if country=="PL" & year_month==2007 & subject==7
replace gov_pm=0 if country=="PL" & year_month==2007 & subject==8
replace gov_pm=0 if country=="PL" & year_month==2007 & subject==9

replace gov_pm=0 if country=="PL" & year_month==2011 & subject==1
replace gov_pm=1 if country=="PL" & year_month==2011 & subject==2
replace gov_pm=0 if country=="PL" & year_month==2011 & subject==3
replace gov_pm=0 if country=="PL" & year_month==2011 & subject==4
replace gov_pm=0 if country=="PL" & year_month==2011 & subject==5
replace gov_pm=0 if country=="PL" & year_month==2011 & subject==6
replace gov_pm=0 if country=="PL" & year_month==2011 & subject==7
replace gov_pm=0 if country=="PL" & year_month==2011 & subject==8
replace gov_pm=0 if country=="PL" & year_month==2011 & subject==9

replace gov_pm=1 if country=="PO" & year_month==2009 & subject==1
replace gov_pm=0 if country=="PO" & year_month==2009 & subject==2
replace gov_pm=0 if country=="PO" & year_month==2009 & subject==3
replace gov_pm=0 if country=="PO" & year_month==2009 & subject==4
replace gov_pm=0 if country=="PO" & year_month==2009 & subject==5

replace gov_pm=1 if country=="PO" & year_month==2011 & subject==1
replace gov_pm=0 if country=="PO" & year_month==2011 & subject==2
replace gov_pm=0 if country=="PO" & year_month==2011 & subject==3
replace gov_pm=0 if country=="PO" & year_month==2011 & subject==4
replace gov_pm=0 if country=="PO" & year_month==2011 & subject==5

replace gov_pm=0 if country=="SV" & year_month==2010 & subject==1
replace gov_pm=0 if country=="SV" & year_month==2010 & subject==2
replace gov_pm=0 if country=="SV" & year_month==2010 & subject==3
replace gov_pm=0 if country=="SV" & year_month==2010 & subject==4
replace gov_pm=0 if country=="SV" & year_month==2010 & subject==5
replace gov_pm=1 if country=="SV" & year_month==2010 & subject==6
replace gov_pm=0 if country=="SV" & year_month==2010 & subject==7
replace gov_pm=0 if country=="SV" & year_month==2010 & subject==8
replace gov_pm=0 if country=="SV" & year_month==2010 & subject==9
replace gov_pm=0 if country=="SV" & year_month==2010 & subject==10
replace gov_pm=0 if country=="SV" & year_month==2010 & subject==11

replace gov_pm=0 if country=="SV" & year_month==2014 & subject==1
replace gov_pm=0 if country=="SV" & year_month==2014 & subject==2
replace gov_pm=0 if country=="SV" & year_month==2014 & subject==3
replace gov_pm=0 if country=="SV" & year_month==2014 & subject==4
replace gov_pm=0 if country=="SV" & year_month==2014 & subject==5
replace gov_pm=1 if country=="SV" & year_month==2014 & subject==6
replace gov_pm=0 if country=="SV" & year_month==2014 & subject==7
replace gov_pm=0 if country=="SV" & year_month==2014 & subject==8
replace gov_pm=0 if country=="SV" & year_month==2014 & subject==9
replace gov_pm=0 if country=="SV" & year_month==2014 & subject==10
replace gov_pm=0 if country=="SV" & year_month==2014 & subject==11

replace gov_pm=1 if country=="UK" & year_month==2005 & subject==1
replace gov_pm=0 if country=="UK" & year_month==2005 & subject==2
replace gov_pm=0 if country=="UK" & year_month==2005 & subject==3

replace gov_pm=1 if country=="UK" & year_month==2010 & subject==1
replace gov_pm=0 if country=="UK" & year_month==2010 & subject==2
replace gov_pm=0 if country=="UK" & year_month==2010 & subject==3

replace gov_pm=0 if country=="UK" & year_month==2015 & subject==1
replace gov_pm=0 if country=="UK" & year_month==2015 & subject==2
replace gov_pm=1 if country=="UK" & year_month==2015 & subject==3
replace gov_pm=0 if country=="UK" & year_month==2015 & subject==4
replace gov_pm=0 if country=="UK" & year_month==2015 & subject==5
replace gov_pm=0 if country=="UK" & year_month==2015 & subject==6

replace gov_pm=0 if country=="ES" & year_month==2004 & subject==1
replace gov_pm=1 if country=="ES" & year_month==2004 & subject==2
replace gov_pm=0 if country=="ES" & year_month==2004 & subject==3
replace gov_pm=0 if country=="ES" & year_month==2004 & subject==4
replace gov_pm=0 if country=="ES" & year_month==2004 & subject==5
replace gov_pm=0 if country=="ES" & year_month==2004 & subject==6
replace gov_pm=0 if country=="ES" & year_month==2004 & subject==7

replace gov_pm=1 if country=="ES" & year_month==2008 & subject==1
replace gov_pm=0 if country=="ES" & year_month==2008 & subject==2
replace gov_pm=0 if country=="ES" & year_month==2008 & subject==3
replace gov_pm=0 if country=="ES" & year_month==2008 & subject==4
replace gov_pm=0 if country=="ES" & year_month==2008 & subject==5
replace gov_pm=0 if country=="ES" & year_month==2008 & subject==6
replace gov_pm=0 if country=="ES" & year_month==2008 & subject==7

replace gov_pm=1 if country=="ES" & year_month==2011 & subject==1
replace gov_pm=0 if country=="ES" & year_month==2011 & subject==2
replace gov_pm=0 if country=="ES" & year_month==2011 & subject==3
replace gov_pm=0 if country=="ES" & year_month==2011 & subject==4
replace gov_pm=0 if country=="ES" & year_month==2011 & subject==5
replace gov_pm=0 if country=="ES" & year_month==2011 & subject==6
replace gov_pm=0 if country=="ES" & year_month==2011 & subject==7

ta gov_pm

******************************************************************
* Junior coalition partner - based on the Prime Minister and Government variable
******************************************************************

gen gov_junior=0
replace gov_junior = 1 if gov_pm==0 & gov==1


********************************************************************
* Party - all parties in each country
********************************************************************

gen parties1 =.
replace parties1 = 1 if subject==1 & country=="CZ"
replace parties1 = 2 if subject==2 & country=="CZ"
replace parties1 = 3 if subject==3 & country=="CZ"
replace parties1 = 4 if subject==4 & country=="CZ"
replace parties1 = 5 if subject==5 & country=="CZ"
replace parties1 = 6 if subject==6 & country=="CZ"
replace parties1 = 7 if subject==7 & country=="CZ"
replace parties1 = 8 if subject==8 & country=="CZ"
replace parties1 = 9 if subject==9 & country=="CZ"

replace parties1 = 10 if subject==1 & country=="DK"
replace parties1 = 11 if subject==2 & country=="DK"
replace parties1 = 12 if subject==3 & country=="DK"
replace parties1 = 13 if subject==4 & country=="DK"
replace parties1 = 14 if subject==5 & country=="DK"
replace parties1 = 15 if subject==6 & country=="DK"
replace parties1 = 16 if subject==7 & country=="DK"
replace parties1 = 17 if subject==8 & country=="DK" & year_month==2007
replace parties1 = 17 if subject==9 & country=="DK" & year_month==2011
replace parties1 = 19 if subject==10 & country=="DK"

replace parties1 = 20 if subject==1 & country=="DE"
replace parties1 = 21 if subject==2 & country=="DE"
replace parties1 = 22 if subject==3 & country=="DE"
replace parties1 = 23 if subject==4 & country=="DE"
replace parties1 = 24 if subject==5 & country=="DE"
replace parties1 = 25 if subject==6 & country=="DE"
replace parties1 = 26 if subject==7 & country=="DE"
replace parties1 = 27 if subject==8 & country=="DE"
replace parties1 = 28 if subject==9 & country=="DE"
replace parties1 = 29 if subject==10 & country=="DE"

replace parties1 = 30 if subject==1 & country=="HU"
replace parties1 = 31 if subject==2 & country=="HU"
replace parties1 = 32 if subject==3 & country=="HU"
replace parties1 = 33 if subject==4 & country=="HU"
replace parties1 = 34 if subject==5 & country=="HU"  & year_month==2006
replace parties1 = 90 if subject==5 & country=="HU"  & year_month==2010
replace parties1 = 35 if subject==6 & country=="HU"
replace parties1 = 36 if subject==7 & country=="HU"
replace parties1 = 37 if subject==8 & country=="HU"
replace parties1 = 38 if subject==9 & country=="HU"

replace parties1 = 39 if subject==1 & country=="NL"
replace parties1 = 40 if subject==2 & country=="NL"
replace parties1 = 41 if subject==3 & country=="NL"
replace parties1 = 42 if subject==4 & country=="NL"
replace parties1 = 43 if subject==5 & country=="NL"
replace parties1 = 44 if subject==6 & country=="NL"
replace parties1 = 45 if subject==7 & country=="NL"
replace parties1 = 46 if subject==8 & country=="NL"
replace parties1 = 47 if subject==9 & country=="NL"
replace parties1 = 48 if subject==10 & country=="NL"
replace parties1 = 49 if subject==11 & country=="NL"

replace parties1 = 50 if subject==1 & country=="PL"
replace parties1 = 51 if subject==2 & country=="PL"
replace parties1 = 52 if subject==3 & country=="PL"
replace parties1 = 53 if subject==4 & country=="PL"
replace parties1 = 54 if subject==5 & country=="PL"
replace parties1 = 55 if subject==6 & country=="PL"
replace parties1 = 56 if subject==7 & country=="PL"
replace parties1 = 57 if subject==8 & country=="PL"
replace parties1 = 58 if subject==9 & country=="PL"

replace parties1 = 59 if subject==1 & country=="PO"
replace parties1 = 60 if subject==2 & country=="PO"
replace parties1 = 61 if subject==3 & country=="PO"
replace parties1 = 62 if subject==4 & country=="PO"
replace parties1 = 63 if subject==5 & country=="PO"

replace parties1 = 64 if subject==1 & country=="SV"
replace parties1 = 65 if subject==2 & country=="SV"
replace parties1 = 66 if subject==3 & country=="SV"
replace parties1 = 67 if subject==4 & country=="SV"
replace parties1 = 68 if subject==5 & country=="SV"
replace parties1 = 69 if subject==6 & country=="SV"
replace parties1 = 70 if subject==7 & country=="SV"
replace parties1 = 71 if subject==8 & country=="SV"
replace parties1 = 72 if subject==9 & country=="SV"
replace parties1 = 73 if subject==10 & country=="SV"
replace parties1 = 74 if subject==11 & country=="SV"

replace parties1 = 75 if subject==1 & country=="UK"
replace parties1 = 76 if subject==2 & country=="UK"
replace parties1 = 77 if subject==3 & country=="UK"
replace parties1 = 78 if subject==4 & country=="UK"
replace parties1 = 79 if subject==5 & country=="UK"
replace parties1 = 80 if subject==6 & country=="UK"

replace parties1 = 83 if subject==1 & country=="ES"
replace parties1 = 84 if subject==2 & country=="ES"
replace parties1 = 85 if subject==3 & country=="ES"
replace parties1 = 86 if subject==4 & country=="ES"
replace parties1 = 87 if subject==5 & country=="ES"
replace parties1 = 88 if subject==6 & country=="ES"
replace parties1 = 89 if subject==7 & country=="ES"

*********************************************************************
*Party Family - values to be found at parlgov.org webpage for each country
******************************************************************
gen familie = .
replace familie=2 if country=="DK" & subject==1
replace familie=1 if country=="DK" & subject==2
replace familie=4 if country=="DK" & subject==3
replace familie=5 if country=="DK" & subject==4
replace familie=3 if country=="DK" & subject==5
replace familie=2 if country=="DK" & subject==6
replace familie=9 if country=="DK" & subject==7
replace familie=2 if country=="DK" & subject==8
replace familie=2 if country=="DK" & subject==9
replace familie=. if country=="DK" & subject==10

replace familie=1 if country=="CZ" & subject==1
replace familie=3 if country=="CZ" & subject==2
replace familie=9 if country=="CZ" & subject==3
replace familie=8 if country=="CZ" & subject==4
replace familie=3 if country=="CZ" & subject==5
replace familie=2 if country=="CZ" & subject==6
replace familie=2 if country=="CZ" & subject==7
replace familie=3 if country=="CZ" & subject==8
replace familie=. if country=="CZ" & subject==9

replace familie=8 if country=="DE" & subject==1
replace familie=8 if country=="DE" & subject==2
replace familie=8 if country=="DE" & subject==3
replace familie=1 if country=="DE" & subject==4
replace familie=2 if country=="DE" & subject==5
replace familie=5 if country=="DE" & subject==6
replace familie=9 if country=="DE" & subject==7
replace familie=4 if country=="DE" & subject==8
replace familie=7 if country=="DE" & subject==9
replace familie=. if country=="DE" & subject==10

replace familie=3 if country=="HU" & subject==1
replace familie=8 if country=="HU" & subject==2
replace familie=3 if country=="HU" & subject==3
replace familie=1 if country=="HU" & subject==4
replace familie=4 if subject==5 & country=="HU"  & year_month==2006
replace familie=4 if subject==5 & country=="HU"  & year_month==2010
replace familie=2 if country=="HU" & subject==6
replace familie=3 if country=="HU" & subject==7
replace familie=5 if country=="HU" & subject==8
replace familie=. if country=="HU" & subject==9

replace familie=1 if country=="NL" & subject==1
replace familie=8 if country=="NL" & subject==2
replace familie=2 if country=="NL" & subject==3
replace familie=2 if country=="NL" & subject==4
replace familie=9 if country=="NL" & subject==5
replace familie=4 if country=="NL" & subject==6
replace familie=8 if country=="NL" & subject==7
replace familie=5 if country=="NL" & subject==8
replace familie=7 if country=="NL" & subject==9
replace familie=2 if country=="NL" & subject==10
replace familie=. if country=="NL" & subject==11

replace familie=3 if country=="PL" & subject==1
replace familie=3 if country=="PL" & subject==2
replace familie=1 if country=="PL" & subject==3
replace familie=6 if country=="PL" & subject==4
replace familie=3 if country=="PL" & subject==5
replace familie=6 if country=="PL" & subject==6
replace familie=2 if country=="PL" & subject==7
replace familie=3 if country=="PL" & subject==8
replace familie=. if country=="PL" & subject==9

replace familie=1 if country=="PO" & subject==1
replace familie=2 if country=="PO" & subject==2
replace familie=9 if country=="PO" & subject==3
replace familie=9 if country=="PO" & subject==4
replace familie=8 if country=="PO" & subject==5

replace familie=9 if country=="SV" & subject==1
replace familie=5 if country=="SV" & subject==2
replace familie=1 if country=="SV" & subject==3
replace familie=6 if country=="SV" & subject==4
replace familie=2 if country=="SV" & subject==5
replace familie=3 if country=="SV" & subject==6
replace familie=8 if country=="SV" & subject==7
replace familie=4 if country=="SV" & subject==8
replace familie=7 if country=="SV" & subject==9
replace familie=. if country=="SV" & subject==10
replace familie=. if country=="SV" & subject==11

replace familie=1 if country=="UK" & subject==1
replace familie=2 if country=="UK" & subject==2
replace familie=3 if country=="UK" & subject==3
replace familie=4 if country=="UK" & subject==4
replace familie=1 if country=="UK" & subject==5
replace familie=. if country=="UK" & subject==6

replace familie=1 if country=="ES" & subject==1
replace familie=3 if country=="ES" & subject==2
replace familie=9 if country=="ES" & subject==3
replace familie=3 if country=="ES" & subject==4
replace familie=7 if country=="ES" & subject==5
replace familie=8 if country=="ES" & subject==6
replace familie=2 if country=="ES" & subject==7

**********************************************************
*Mainstream or Niche - based on values about party family
**********************************************************
 gen fam_main =.
 replace fam_main =1 if familie==1
 replace fam_main =1 if familie==2
 replace fam_main =1 if familie==3 
 replace fam_main =0 if familie==4 
 replace fam_main =0 if familie==5  
 replace fam_main =0 if familie==6  
 replace fam_main =0 if familie==7  
 replace fam_main =1 if familie==8
 replace fam_main =0 if familie==9
 ta fam_main

**********************************************************
*Days to the Election Day in each country
**********************************************************
 generate article_date_01 = .
 format article_date_01 %td
 replace article_date_01 = td(07may2015) if country == "UK" & year_month==2015
 replace article_date_01 = td(06may2010) if country == "UK" & year_month==2010
 replace article_date_01 = td(05may2005) if country == "UK" & year_month==2005
 replace article_date_01 = td(19sep2010) if country == "SV" & year_month==2010
 replace article_date_01 = td(14sep2014) if country == "SV" & year_month==2014
 replace article_date_01 = td(27sep2009) if country == "PO" & year_month==2009
 replace article_date_01 = td(05jun2011) if country == "PO" & year_month==2011
 replace article_date_01 = td(19oct2007) if country == "PL" & year_month==2007
 replace article_date_01 = td(09oct2011) if country == "PL" & year_month==2011 
 replace article_date_01 = td(09jun2010) if country == "NL" & year_month==2010
 replace article_date_01 = td(12sep2012) if country == "NL" & year_month==2012
 replace article_date_01 = td(09apr2006) if country == "HU" & year_month==2006
 replace article_date_01 = td(25apr2010) if country == "HU" & year_month==2010 
 replace article_date_01 = td(27sep2009) if country == "DE" & year_month==2009
 replace article_date_01 = td(22sep2013) if country == "DE" & year_month==2013 
 replace article_date_01 = td(13nov2007) if country == "DK" & year_month==2007
 replace article_date_01 = td(15sep2011) if country == "DK" & year_month==2011  
 replace article_date_01 = td(29may2010) if country == "CZ" & year_month==2010
 replace article_date_01 = td(25oct2013) if country == "CZ" & year_month==2013
 replace article_date_01 = td(14mar2004) if country == "ES" & year_month==2004
 replace article_date_01 = td(09mar2008) if country == "ES" & year_month==2008
 replace article_date_01 = td(20nov2011) if country == "ES" & year_month==2011
 
generate days = article_date_01 - article_date 
replace days = . if days >28
replace days = . if days <1
ta days

************************************************************
*recode the country variable
************************************************************

encode country, generate(country_new)

************************************************************
*recode valence-issue variable
************************************************************

gen val_issue=.
replace val_issue=1 if statement_type=="SelfIssue"
replace val_issue=2 if statement_type=="SelfIssueVal"
replace val_issue=3 if statement_type=="SelfVal"
ta val_issue

gen issue3=.
replace issue3=1 if val_issue==1
replace issue3=0 if val_issue==3

**********************************************************
* use data with values on all relevant variables
**********************************************************

keep if gov_pm !=. & gov_junior !=. &  days!=. &  fam_main!=. &  hv_prox!= .  

***********************************************************
* foodnote 7
***********************************************************

tab val_issue


***********************************************************
*Table 2 --> go to excel sheet
***********************************************************

tab country_new issue3 

***********************************************************
* Table 3 --> go to excel sheet
***********************************************************

tab gov_pm issue3

gen hv_dic15 = 0
replace hv_dic15 = 1 if hv_prox <= 1.5
ta hv_dic15

tab hv_dic15 issue3


************************************************************
* Table 4
************************************************************
keep if gov_pm !=. & gov_junior !=. &  days!=. &  fam_main!=. &  hv_prox!= .  & issue3 !=.

sum issue3 gov_pm gov_junior days fam_main hv_prox


***************************************************************** 
*Cluster on country*year
*****************************************************************
 
gen election_interc = country * year
 
encode election_interc, generate(election_interc_new)
ta election_interc

***************************************************************** 
*Table 5 Logit models
*****************************************************************

logit issue3 gov_pm  hv_prox i.election_interc_new, vce(cluster parties1) 
logit issue3 gov_pm gov_junior days fam_main hv_prox i.election_interc_new, vce(cluster parties1) 


 
 
 
